<template>
    <sc-table-select ref="tableselect" v-model="ticket" :attrList="attrList" :valueList="valueList" :queryList="queryList"
        :table-width="640" collapse-tags collapse-tags-tooltip :props="props" @change="change">
        <template #header="{ }">
            <el-form :inline="true">
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="名称" label-width="100px">
                            <el-input v-model="queryList.ConsumeRuleName" placeholder="请输入消费规则名称" style="width: 120px"></el-input>
                        </el-form-item>
                        <el-button type="primary" @click="$refs.tableselect.getData()" style="margin-top: -15px;">查询</el-button>
                    </el-col>
                </el-row>
            </el-form>
        </template>
        <el-table-column prop="ConsumeRuleCode" label="编码" width="100"></el-table-column>
        <el-table-column prop="ConsumeRuleName" label="消费规则名称" width="180"></el-table-column>
        <el-table-column prop="Conditions" label="规则内容" width="180">
            <template #default="scope">
                <span>满{{ scope.row.Conditions }}获得{{ scope.row.GivePoint }}积分,获得{{ scope.row.GiveCoins }}金币</span>
            </template>
        </el-table-column>
        <el-table-column prop="State" label="状态" width="120"></el-table-column>
    </sc-table-select>
</template>

<script>
import publicjs from "@/api/model/publicjs";
export default {
    name: "scConsumeRuleChoice",
    data() {
        return {
            attrList: {
                Name: "MemberConsumeRule",
                UseDistinct: false,
                OrgCode: "",
                UseBackUp: false,
                UseGroup: false,
            },
            valueList: { ConsumeRuleCode: "ConsumeRuleCode", ConsumeRuleName: "ConsumeRuleName", Conditions: "Conditions", GivePoint: "GivePoint", GiveCoins: "GiveCoins",State: "State", },
            queryList: { State: "1", ConsumeRuleName: "", },
            //apiObj: this.$API.demo.page,
            params: {
                name: "demoName",
            },
            optionsType: [],

        };
    },
    computed: {},
    methods: {
        async initOptions() {
            var head = new publicjs.head();
            publicjs.initHead(head, "getfirstdatasource");
            var ed1 = new publicjs.entitydata(head);
            var eo1 = new publicjs.entityobj();
            eo1.AttrList = {
                Name: "MemberCouponTicket",
                AcceptControl: "TypeCode",
                OrgCode: "",
            };
            ed1.Data.Content.ObjectList.Object.push(eo1);
            try {
                var returnValueStr1 = await this.$API.auth.objProcess.post(ed1);
                var returnValue1 = JSON.parse(returnValueStr1);
                if (returnValue1.Result.OpFlag == "1") {
                    this.optionsType = returnValue1.Result.Content.ObjectList.Object.rows.row;
                    // this.optionsOperType = objectList.rows.row;
                } else {
                    this.$message.error("操作失败:" + returnValue1.Result.OpMsg);
                }
            } catch (error) {
                this.loading = false;
                this.$alert(error.message, "提示", { type: "error" });
                return false;
            }
        }
    },
    async mounted() {
        // await this.initOptions();
    },
};
</script>

<style scoped></style>
